# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gdk-pixbuf
pkgver=2.40.0
pkgrel=2
pkgdesc="GTK+ image loading library"
url="https://wiki.gnome.org/Projects/GdkPixbuf"
arch="all"
license="LGPL-2.0-or-later"
depends="shared-mime-info"
depends_dev="shared-mime-info"
makedepends="tiff-dev libjpeg-turbo-dev gobject-introspection-dev
	libpng-dev glib-dev meson"
install="$pkgname.pre-deinstall"
triggers="$pkgname.trigger=/usr/lib/gdk-pixbuf-2.0/*/loaders"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-dbg"
source="https://download.gnome.org/sources/gdk-pixbuf/${pkgver%.*}/gdk-pixbuf-$pkgver.tar.xz"
replaces="gtk+"

# secfixes:
#   2.36.6-r1:
#     - CVE-2017-6311
#     - CVE-2017-6312
#     - CVE-2017-6314

build() {
	meson \
		--prefix=/usr \
		--buildtype=plain \
		-Dinstalled_tests=false \
		output .
	ninja -C output
}

check() {
	# pixbuf-area-updated takes over 50 minutes to run on Drone
	case $CARCH in
		armhf)
			if test $DRONE; then
				sed -i '/pixbuf-area-updated/d' tests/meson.build
			fi
		;;
	esac

	meson test -t 10 -C output
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
}

doc() {
	replaces="gtk+-doc"
	default_doc
}

dev() {
	replaces="gtk+-dev"
	default_dev
}

sha512sums="6512befd379494dbfd89a16fc4c92641842eb7b82fc820ec83a5b057526209947db646570db1124c073b0ef69c117bdf0f8d3fea807e302a4950db39187c35aa  gdk-pixbuf-2.40.0.tar.xz"
